#include					"RingBuffer.h"

RingBuffer::RingBuffer(size_t size, size_t bufsize) : _capacity(size)
{
	_index = 0;
	for (size_t i = 0; i < _capacity; i++)
		_buffer.push_back(new short[bufsize]);
}

RingBuffer::~RingBuffer()
{
	for (size_t i = 0; i < _capacity; i++)
		delete _buffer[i];
}

short						*RingBuffer::get()
{
	short					*ret = _buffer[_index];

	_index++;
	_index = _index % _capacity;
	return ret;
}